package com.example.pclimb.model;

import androidx.room.Entity;
import androidx.room.ForeignKey;
import androidx.room.Index;
import androidx.room.PrimaryKey;
import androidx.room.Ignore;

import java.util.Date;

/**
 * 评价实体类
 */
@Entity(tableName = "reviews",
        foreignKeys = {
                @ForeignKey(entity = User.class,
                        parentColumns = "id",
                        childColumns = "userId",
                        onDelete = ForeignKey.CASCADE),
                @ForeignKey(entity = User.class,
                        parentColumns = "id",
                        childColumns = "guideId",
                        onDelete = ForeignKey.CASCADE),
                @ForeignKey(entity = ClimbRequest.class,
                        parentColumns = "id",
                        childColumns = "requestId",
                        onDelete = ForeignKey.CASCADE)
        },
        indices = {
                @Index("userId"),
                @Index("guideId"),
                @Index("requestId")
        })
public class Review {
    @PrimaryKey(autoGenerate = true)
    private int id;
    private int userId; // 评价用户ID
    private int guideId; // 被评价的陪爬人员ID
    private int requestId; // 陪爬请求ID
    private float rating; // 评分（1-5星）
    private String comment; // 评价内容
    private Date reviewDate; // 评价日期
    @Ignore
    public Review() {
    }

    public Review(int userId, int guideId, int requestId, float rating, String comment) {
        this.userId = userId;
        this.guideId = guideId;
        this.requestId = requestId;
        this.rating = rating;
        this.comment = comment;
        this.reviewDate = new Date();
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public int getGuideId() {
        return guideId;
    }

    public void setGuideId(int guideId) {
        this.guideId = guideId;
    }

    public int getRequestId() {
        return requestId;
    }

    public void setRequestId(int requestId) {
        this.requestId = requestId;
    }

    public float getRating() {
        return rating;
    }

    public void setRating(float rating) {
        this.rating = rating;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public Date getReviewDate() {
        return reviewDate;
    }

    public void setReviewDate(Date reviewDate) {
        this.reviewDate = reviewDate;
    }
} 